{extend name="layout:base" /}{block name="content"}
 <?php
$global=isSupperManagerForSession();
 ?>
 <style>
.table th{text-align:center;}
</style>
<section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
         <span data-url="/admin/newstype/lists" onclick="ContentLoadGo('/admin/newstype/lists')">栏目管理</span>
         </div>
      </section>
   
      <section style="margin-top:10px;margin-left:auto;margin-right:auto;">
      <select name="ser_key" id="ser_key" class="select" >
       <option value="name" <?php if($request['ser_key']=="name"){echo 'selected';} ?>>栏目名称</option>
      
      </select>
      
      <input type="text" class="textbox" name="ser_val" id="ser_val" value="<?php echo $request['ser_val']; ?>" placeholder=""/>
     
     
     
     
      <input type="button" value="搜索" class="group_btn research" id="resource" page="1" />
      	
      <input power="30200" type="button" value="添加" class="group_btn add fr" />
      	
      <br style="clear:both;width:0px;height:0px;">
     </section>
 
       
   
<table class="table" style="margin-top:10px;">

<tr>

<th style="width:300px;">栏目名称</th>
<th style="width:100px;">排序</th>
<th style="width:100px;">创建时间</th>

<th style="width:80px;">操作</th>
</tr>

<?php 

foreach($lists['data'] as $key=>$val)
{
?>
<tr data-id="<?php echo $val['id']; ?>">

<td  style="text-align:left;">
<?php echo $val['name']; ?>
</td>
<td  style="text-align:left;">
<?php echo $val['sorts']; ?>
</td>

<td>
<?php echo date("Y-m-d H:i:s",$val['ctime']); ?>
</td>


<td style="text-align:right;">
<input type="button" power="30300" value="修改" class="link_btn edit"/>	
<input type="button" power="30400" value="删除" class="link_btn del"/>
</td>
</tr>
      <?php
      }
	  ?>
</table>
{include file="../application/admin/view/layout/page_tpl_new.html" /}
      <script type="text/javascript">
      
      function myResearch(){
		   var url="/admin/newstype/lists";
		   var ser_key =$("#ser_key").val();
		   var ser_val =$("#ser_val").val();
		  
		 
		   var page=$("#cpage").val();
		   var param={
				   ser_key:ser_key, 
				   ser_val:ser_val, 
				   page:page
		   };
		   ContentLoadGo(url,param);
	   }
     
      
           $(function(){
        	   //设置搜索栏
        	 $(".research").unbind().bind("click",function(){
        		   var page =$(this).attr("page");
        		   $("#cpage").val(page);
        		   myResearch();
        		   
        	   });
        	   
        	   $(".del").unbind().bind("click",function(){
        		   var that =this;
        		   var url="/admin/newstype/delData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   cofirmsss_tishi(1,'您确定要删除吗?',function(id){
        			 
        			   AjaxRequest(url,param,function(data){
            			   if(data.err==0)
            			   {
            				   SuccessTiShi("操作成功");
            				   
            				   $(that).parent().parent().remove();
            				   myResearch();
            			   }
            			   else
            			   {
            				   ErrTiShi(data.msg);
            			   }
            		   });
        			   
        		   });
        	   });
        	
        	   
        	   $(".edit").unbind().bind("click",function(){
        		   var that =this;
        		   var url="/admin/newstype/editData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   ContentLoadGo(url,param);
        			
        	   });

        	   $(".info").unbind().bind("click",function(){
        		   var that =this;
        		   var url="/admin/newstype/infoData";
        		   var id=$(that).parent().parent().attr('data-id');
        		   var param={
        				   id:id
        		   };
        		   ContentLoadGo(url,param);
        			
        	   });
        	   
        	   //导航
     
               $(".topBannerItem").unbind().bind("click",function(){
         		   var attArr = $(this).attr();
             	   goToSelfLink(attArr);
             	   
         			
         	   });
         	  $(".add").unbind().bind("click",function(){
        		   
        		   var that =this;
        		   var url="/admin/newstype/addData";
        		   var param={};
        		   ContentLoadGo(url,param);
        			 //弹出：确认按钮
        			
        	   });
        	   
  			   //全选
  		  $("#all").unbind().bind("click",function(){
			    	if(this.checked){   
			        	$(".checkBoxInput").attr("checked", true);  
			        	$(".checkBoxInput").prop("checked", true);  
			    	}else{   
						$(".checkBoxInput").attr("checked", false);
						$(".checkBoxInput").prop("checked", false);
			    	}   
			    	var se=getAllSelectItem();
			    	//console.log(se);
			 	}); 
  			   
  			   
  			
           });
           
	  </script>
	  
	  {/block}
   